<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>资源共享 -主页</title>

<!--[if lt IE 8]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

<link href="./css/bootstrap.min.css" rel="stylesheet">
<link href="./css/font-awesome.min.css" rel="stylesheet">
<link href="./css/animate.min.css" rel="stylesheet">
<link href="./css/style.min.css" rel="stylesheet">
<script src="./js/jquery.min.js"></script>
<script src="./js/bootstrap.min.js"></script>
<script src="./js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="./js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="./js/plugins/layer/layer.min.js"></script>
<script src="./js/hplus.min.js"></script>
<script src="./js/contabs.min.js" type="text/javascript"></script>
<script src="./js/plugins/pace/pace.min.js"></script>
<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<script src="js/plugins/sweetalert/sweetalert.min.js"></script>


</head>

<body class="fixed-sidebar full-height-layout gray-bg"
	style="overflow: hidden">
	<div id="wrapper">
		<!--左侧导航开始-->
		<nav class="navbar-default navbar-static-side" role="navigation">
		<div class="nav-close">
			<i class="fa fa-times-circle"></i>
		</div>
		<div class="sidebar-collapse">
			<ul class="nav" id="side-menu">
				<li class="nav-header">
					<div class="dropdown profile-element">
						<span><img alt="image" width="80px" height="80px"
							src="${loginUser.picture}" class="img-circle"
							onerror="this.src='img/profile_small.jpg'" /></span> <span
							class="clear"> <a data-toggle="dropdown"
							class="dropdown-toggle" href="#"> <span class="clear">
									<span class="block m-t-xs"><strong class="font-bold"><c:out
												value="${loginUser.name }"></c:out></strong> &nbsp;&nbsp; <c:out
											value="${loginUser.position }"></c:out> <b class="caret"></b></span>
							</span>
						</a>
							<ul class="dropdown-menu animated fadeInRight m-t-xs">
								<%--<li><a class="J_menuItem" href="userDetail.do?id=1">个人资料</a></li>--%>
								<li><a class="J_menuItem"
									onclick="showModal(editPasswordModal)">修改密码</a></li>
								<li class="divider"></li>
								<li><a onclick="loginOff()">注销登录</a></li>
							</ul>
					</div>
					<div class="logo-element">滨</div>
				</li>
				<c:forEach var="menu" items="${menu }">
					<c:if
						test="${menu.id eq 45 and menu.isStart eq 1 and menu.status eq 0 }">
						<li><a href="#"><i class="fa fa-gears"></i><span
								class="nav-label">服务管理</span><span class="fa arrow"></span> </a>
							<ul class="nav nav-second-level">
								<c:forEach var="menuChilds" items="${menu.childMenus }">
									<c:if
										test="${menuChilds.isStart eq 1 and menuChilds.status eq 0}">
										<li><a class="J_menuItem" href="${menuChilds.href }">${menuChilds.name }</a></li>
									</c:if>
								</c:forEach>
							</ul></li>
					</c:if>
					<c:if
						test="${menu.id eq 44 and menu.isStart eq 1 and menu.status eq 0 }">
						<li><a href="#"><i class="fa fa-gears"></i><span
								class="nav-label">新闻管理</span><span class="fa arrow"></span> </a>
							<ul class="nav nav-second-level">
								<c:forEach var="menuChilds" items="${menu.childMenus }">
									<c:if
										test="${menuChilds.isStart eq 1 and menuChilds.status eq 0}">
										<li><a class="J_menuItem" href="${menuChilds.href }">${menuChilds.name }</a></li>
									</c:if>
								</c:forEach>
							</ul></li>
					</c:if>
					<c:if
						test="${menu.id eq 59 and menu.isStart eq 1 and menu.status eq 0 }">
						<li><a href="#"><i class="fa fa-gears"></i><span
								class="nav-label">平台管理</span><span class="fa arrow"></span> </a>
							<ul class="nav nav-second-level">
								<c:forEach var="menuChilds" items="${menu.childMenus }">
									<c:if
										test="${menuChilds.isStart eq 1 and menuChilds.status eq 0}">
										<li><a class="J_menuItem" id="${menuChilds.id }" href="${menuChilds.href }">${menuChilds.name }</a></li>
									</c:if>
								</c:forEach>
							</ul></li>
					</c:if>
					<c:if
						test="${menu.id eq 46 and menu.isStart eq 1 and menu.status eq 0 }">
						<li><a href="#"><i class="fa fa-cubes"></i><span
								class="nav-label">${menu.name }</span><span class="fa arrow"></span>
						</a>
							<ul class="nav nav-second-level">
								<c:forEach var="menuChilds" items="${menu.childMenus }">
									<c:if
										test="${menuChilds.isStart eq 1 and menuChilds.status eq 0}">
										<li><a class="J_menuItem" href="${menuChilds.href }">${menuChilds.name }</a></li>
									</c:if>
								</c:forEach>
							</ul></li>
					</c:if>
					<c:if
						test="${menu.id eq 47 and menu.isStart eq 1 and menu.status eq 0 }">
						<li><a href="#"><i class="fa fa-sitemap"></i><span
								class="nav-label">${menu.name }</span><span class="fa arrow"></span>
						</a>
							<ul class="nav nav-second-level">
								<c:forEach var="menuChilds" items="${menu.childMenus }">
									<c:if
										test="${menuChilds.isStart eq 1 and menuChilds.status eq 0}">
										<li><a class="J_menuItem" href="${menuChilds.href }">${menuChilds.name }</a></li>
									</c:if>
								</c:forEach>
							</ul></li>
					</c:if>
					<c:if
						test="${menu.id eq 48 and menu.isStart eq 1 and menu.status eq 0 }">
						<li><a href="#"><i class="fa fa-map"></i><span
								class="nav-label">${menu.name }</span><span class="fa arrow"></span>
						</a>
							<ul class="nav nav-second-level">
								<c:forEach var="menuChilds" items="${menu.childMenus }">
									<c:if
										test="${menuChilds.isStart eq 1 and menuChilds.status eq 0}">
										<li><a class="J_menuItem" href="${menuChilds.href }">${menuChilds.name }</a></li>
									</c:if>
								</c:forEach>
							</ul></li>
					</c:if>
					<c:if
						test="${menu.id eq 49 and menu.isStart eq 1 and menu.status eq 0 }">
						<li><a href="#"><i class="fa fa-user"></i><span
								class="nav-label">${menu.name }</span><span class="fa arrow"></span>
						</a>
							<ul class="nav nav-second-level">
								<c:forEach var="menuChilds" items="${menu.childMenus }">
									<c:if
										test="${menuChilds.isStart eq 1 and menuChilds.status eq 0}">
										<li><a class="J_menuItem" href="${menuChilds.href }">${menuChilds.name }</a></li>
									</c:if>
								</c:forEach>
							</ul></li>
					</c:if>
				</c:forEach>
			</ul>
		</div>
		</nav>
		<!--左侧导航结束-->
		<!--右侧部分开始-->
		<div id="page-wrapper" class="gray-bg dashbard-1">
			<div class="row border-bottom">
				<nav class="navbar navbar-static-top" role="navigation"
					style="margin-bottom: 0">
				<div class="navbar-header">
					<a class="navbar-minimalize minimalize-styl-2 btn btn-primary "
						href="#"><i class="fa fa-bars"></i> </a>
					<h2>&nbsp;&nbsp;&nbsp;资源共享平台</h2>
				</div>
				<%--<div style="float: right; margin: 10px;">
					<a class="btn btn-info" href="index.do">进入前台</a>
				</div>--%>
				</nav>
			</div>
			<div class="row content-tabs">
				<button class="roll-nav roll-left J_tabLeft">
					<i class="fa fa-backward"></i>
				</button>
				<nav class="page-tabs J_menuTabs">
				<div class="page-tabs-content">
					<%--<a class="active J_menuTab" data-id="#">首页</a>--%>
				</div>
				</nav>
				<button class="roll-nav roll-right J_tabRight">
					<i class="fa fa-forward"></i>
				</button>
				<div class="btn-group roll-nav roll-right">
					<button class="dropdown J_tabClose" data-toggle="dropdown">
						操作<span class="caret"></span>
					</button>
					<ul role="menu" class="dropdown-menu dropdown-menu-right">
						<li class="J_tabCloseAll"><a>关闭全部选项卡</a></li>
						<li class="J_tabCloseOther"><a>关闭其他选项卡</a></li>
					</ul>
				</div>
				<a onclick="loginOff()" class="roll-nav roll-right J_tabExit"><i
					class="fa fa fa-sign-out"></i> 注销</a>
			</div>
			<div class="row J_mainContent" id="content-main">
				<iframe class="J_iframe" name="iframe0" width="100%" height="100%"
					src="" frameborder="0" data-id="index_v2.html" seamless></iframe>
			</div>
		</div>
		<!--右侧部分结束-->
		<!--右侧边栏开始-->


	</div>
	<!--右侧边栏结束-->
	</div>

	<!--修改密码的模态层  -->
	<div class="modal fade  " id='editPasswordModal'>
		<div class="modal-dialog" style="width: 500px; height: 500px;">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss='modal'>×</button>
					<h2 class="modal-title" align="center">修改密码</h2>
				</div>

				<div class="modal-body" align="center">
					<form class="form-horizontal m-t" id="signupForm">
						<div class="form-group">
							<label class="col-sm-3 control-label">用户名：</label>
							<div class="col-sm-8">
								<input id="email" name="email" class="form-control" type="text"
									value="${loginUser.name }" disabled="disabled">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">账号：</label>
							<div class="col-sm-8">
								<input id="username" name="username" class="form-control"
									type="text" value="${loginUser.userCard }" disabled="disabled">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">原密码<span
								style="color: red;">*</span>：
							</label>
							<div class="col-sm-8">
								<input id="relpwd" name="relpwd" class="form-control"
									type="password">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">新密码<span
								style="color: red;">*</span>：
							</label>
							<div class="col-sm-8">
								<input id="password" name="password" class="form-control"
									type="password">
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label">确认新密码<span
								style="color: red;">*</span>：
							</label>
							<div class="col-sm-8">
								<input id="confirm_password" name="confirm_password"
									class="form-control" type="password"> <span
									style="text-align: left;" class="help-block m-b-none"><i
									class="fa fa-info-circle"></i> 请再次输入您的新密码</span>
							</div>
						</div>
					</form>
					<div class="modal-footer" align="center">
						<div align="center">
							<button class="btn btn-primary" id="btnSubmit" type="button">提交</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript">
    window.onload =function()
    {
        $("#70").click();
    }
	$("#btnSubmit").click(
			function() { //“登录”按钮单击事件
				//获取用户名称
				var relpwd = $("#relpwd").val();
				var password = $("#password").val();
				var confirm_password = $("#confirm_password").val();
				console.log(password)
				if (relpwd == null || relpwd == "") {
					swal("请重新输入原密码", "原密码不能为空", "error");
					return false;
				}
				if (password != confirm_password) {
					swal("请重新输入新密码与确认新密码", "新密码与确认新密码不一致", "error");
					return false;
				} else if (confirm_password != "" && password != ""
						&& password.length < 5) {
					swal("请重新输入新密码与确认新密码", "密码长度必须大于五位", "error");
					return false;
				}

				if (confirm_password != "" && password != "") {
					$.ajax({
						url : "changePassword.do",
						type : "post",
						data : {
							password : password,
							relpwd : relpwd
						},
						async : false,
						error : function(request) {
							swal("修改失败!", "密码修改提示!", "error");
						},
						success : function(data) {
							if (data == 1) {
								swal("修改成功", "修改密码提示", "success");
								closeModal(editPasswordModal)
								//  				location = "loginOff.do"
							} else if (data == 2) {
								swal("请重新输入原密码", "您输入的原密码不正确", "error");
							} else {
								swal("修改失败!", "密码修改提示!", "error");
							}
							$('#signupForm')[0].reset();
						}
					});
				} else {
					swal("请填写新密码", "新密码不能为空", "error");
				}
			});

	//注销
	function loginOff() {
		swal({
			title : "您确定要注销登录吗",
			text : "",
			type : "warning",
			showCancelButton : true,
			confirmButtonColor : "#DD6B55",
			confirmButtonText : "确定",
			cancelButtonText : "取消",
			closeOnConfirm : false
		}, function() {
			location.href = "loginOff.do";
		});
	}

	//显示modal
	function showModal(modal) {
		$(modal).modal("show");
	}
	//隐藏modal
	function closeModal(modal) {
		$(modal).modal("hide");
	}
	/* function clickName() {
		document.getElementById("indexPageId").click();
	} */
</script>
</html>